﻿Type=StaticCode
Version=3.15
@EndOfDesignText@
'Code module
'Subs in this code module will be accessible from all modules.
Sub Process_Globals
	'These global variables will be declared once when the application starts.
	'These variables can be accessed from all modules.

End Sub

Sub DataSet2JSon(ADataSet As Cursor) As String
	Dim sbResult,sbText As StringBuilder
	Dim sField,sValue As String
	
	sbResult.Initialize	
	
	For i = 0 To ADataSet.RowCount - 1
		Dim sbText As StringBuilder
		sbText.Initialize
		
		ADataSet.Position = i
		
		For j = 0 To ADataSet.ColumnCount -1 
			sField = ADataSet.GetColumnName(j)
			sValue = ADataSet.GetString2(j)
			
			sbText.Append(",""").Append(sField).Append(""":""").Append(sValue).Append("""")
		
		Next
		
		If sbText.Length>0 Then
			sbText.Remove(0,1)	
			sbResult.Append(",{").Append(sbText).Append("}")
		End If
		
	Next

		If sbResult.Length>0 Then
			sbResult.Remove(0,1)	
		End If
	
	Return sbResult.ToString
End Sub